package com.learn.annotation_config.conditional;

import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.type.AnnotatedTypeMetadata;

public class ConditionImpl implements Condition {
    // 重写的matches方法，该方法返回true则托管，返回false则不托管
    @Override
    public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
        String propertyValue = System.getProperty("registerAllBean");
        return "true".equalsIgnoreCase(propertyValue);
    }
}
